using System;
using Deepcode.Flux.Core.Extensions;
using Deepcode.Flux.Core.Extensions.Codons;
using Deepcode.Flux.Core.Services.Security;

namespace Deepcode.Flux.Core.Codons
{
	/// <summary>
	/// Abstract class for any codons that require permissions to be checked
	/// </summary>
	public abstract class AbstractPermissionCodon : AbstractCodon
	{
		[XmlCodonAttribute("permission")]
		protected string permission = "";
		
		public bool CheckUser()
		{
			if( AdministrationSecurity.UserHasPermission( permission )) return true;
			return false;
		}
	}
}
